<?php
$client = new swoole_client(SWOOLE_SOCK_TCP);
if (!$client->connect('127.0.0.1', 9501, -1))
{
    exit("connect failed. Error: {$client->errCode}\n");
}

//邮件发送类型 1:群发；2：单条
$type=2;
//发送消息给服务器
$client->send(json_encode($type));
//接收服务器返回信息
echo $client->recv();
//关闭
$client->close();